Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Using the SESSION handle to identify dynamic objects

One final procedure to look at in h-dbbrowser.w is listTempTables. This procedure populates the drop-down list of available temp-tables after you have built one or more of them using the dialog box. It illustrates the usefulness of the SESSION handle as a way to get at various kinds of objects that you’ve created since your session started. In this case, the session keeps track of a list of all dynamic buffers created in the session. The FIRST-BUFFER attribute gives you the first one. The NEXT-SIBLING attribute walks through the list. If a buffer has a TABLE-HANDLE, then it is a buffer for a temp-table, and the procedure adds it to the drop-down list:

  hBuffer = SESSION:FIRST-BUFFER. 
  /* Walk through the list of buffers that belong to Dynamic Tenp Tables*/ 
  DO WHILE VALID-HANDLE(hBuffer): 
    IF VALID-HANDLE(hBuffer:TABLE-HANDLE) THEN 
    DO: 
        /* Convert the handle to a string */ 
        cHandle = STRING(hBuffer:TABLE-HANDLE). 
        /* If the handle is not in cList, add it */ 
        IF NOT CAN-DO(cList,cHandle) THEN 
          cList = cList + (IF cList = "" THEN "" ELSE ",") 
                + cHandle. 
    END. 
    /* Go on to the next Buffer */ 
    hBuffer = hBuffer:NEXT-SIBLING. 
  END. 
  RETURN cList.    /* Function return value. */ 

This comprehensive example has used just about every aspect of programming with both dynamic visual objects and dynamic database objects. Remember that dynamic programming like this is valuable when you need to create a single procedure to use in a variety of situations, just as this window can display fields from any table.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095